<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Services\StoreService;
use Illuminate\Http\Request;

class StoreController extends Controller
{
    public function getAppStoreList(StoreService $storeService , Request $request)
    {
        $params = $request->input();
        $params['uid'] = $this->getUid();
        $result = $storeService->getAppStoreList($params);
        return $this->responseSuccess($result);
    }

    public function getStoreList(StoreService $storeService , Request $request)
    {
        $params = $request->input();
        $rid = $this->getRid();
        if($rid != 1){
            $params['uid'] = $this->getUid();
        }
        $result = $storeService->getStoreList($params);
        return $this->responseSuccess($result);
    }

    public function storeList(StoreService $storeService , Request $request)
    {
        $params = $request->input();
        $result = $storeService->getList($params);
        return $this->responseSuccess($result);
    }

    public function storeEdit(StoreService $storeService , Request $request)
    {
        $params = $request->input();
        $result = $storeService->storeUpdate($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError("更新失败，请重试！");
    }

    public function storeDel(StoreService $storeService , Request $request)
    {
        $params = $request->input();
        $result = $storeService->storeDelete($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError("删除失败，请重试！");
    }
}
